﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        function showNames() {
            var email = document.getElementById('email');
            var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
            if (!filter.test(email.value)) {
                document.getElementById("emailError").style.display = "inline"; 
                email.focus
                return false;
            }
            else 
            {
                document.getElementById("emailError").style.display = "none";
            }
            value1 =document.namesForm.firstName.value;
            value2 = document.namesForm.lastName.value;
            var currDate = new Date();
            var hour = currDate.getHours();
            var min = currDate.getMinutes();
            var sec = currDate.getSeconds();
            var time="" + hour + ":" + min + ":" + sec;
            alert(value1+" "+value2+" "+time);
        }
    </script>	
</head>
<body>
<form name="namesForm">
<input type="text" name="firstName"/><br/>
<input type="text" name="lastName"/><br/>
<input type="text" id="email" />
<span id="emailError" style="color:red; display:none">* invalid!</span><br/>
<input type="button" value="Process" 
      onclick="javascript: showNames()" />
</form>
</body>
</html>
